function func () {
    let a = 1
    if (a < 0) {
        a = -a
    }
    return a
}
func()

var a;

/*
pass 1
        set_loc_uninitialized 0: a
        enter_scope 1
        line_num 2
        push_i32 1
        scope_put_var_init a,1
        line_num 3
        enter_scope 2
        scope_get_var a,2
        push_i32 0
        lt
        if_false 0:94
        enter_scope 3
        line_num 4
        scope_make_ref a,1:78,3
        scope_get_var a,3
        neg
        label 1:78
   78:  insert3
        put_ref_value
        drop
        leave_scope 3
        line_num 5
        label 0:94
   94:  leave_scope 2
        line_num 6
        scope_get_var a,1
        return

pass 2
        set_loc_uninitialized 0: a
        line_num 2
        push_i32 1
        put_loc 0: a
        line_num 3
        get_loc_check 0: a
        push_i32 0
        lt
        if_false 0:59
        line_num 4
        get_loc_check 0: a
        neg
        dup
        put_loc_check 0: a
        drop
        line_num 5
        label 0:59
   59:  line_num 6
        get_loc_check 0: a
        return

./test2.js:1: function: func
  locals:
    0: let a [level:1 next:-1]
  stack_size: 2
  opcodes:
;; function func () {

        set_loc_uninitialized 0: a

;;     let a = 1

        push_1 1
        put_loc0 0: a

;;     if (a < 0) {

        get_loc_check 0: a
        push_0 0
        lt
        if_false8 21

;;         a = -a

        get_loc_check 0: a
        neg
        dup
        put_loc_check 0: a
        drop

;;     }
;;     return a

   21:  get_loc_check 0: a
        return

;; }

pass 1
        line_num 0
        enter_scope 1
        line_num 8
        scope_get_var func,1
        call 0
        put_loc 0: "<ret>"
        line_num 10
        get_loc 0: "<ret>"
        return

pass 2
        check_define_var func,64
        check_define_var a,0
        line_num 0
        fclosure 0: [bytecode func]
        define_func func,0
        define_var a,0
        line_num 8
        get_var func
        call 0
        put_loc 0: "<ret>"
        line_num 10
        get_loc 0: "<ret>"
        return

./test2.js:1: function: <eval>
  locals:
    0: var <ret>
  stack_size: 1
  opcodes:
        check_define_var func,64
        check_define_var a,0
        fclosure8 0: [bytecode func]
        define_func func,0
        define_var a,0
        get_var func
        call0 0
        set_loc0 0: "<ret>"
        return


Process finished with exit code 0





pass 1
        enter_scope 1
        line_num 4
        push_i32 1
        scope_put_var_init a,1
        line_num 5
        enter_scope 2
        scope_get_var a,2
        push_i32 0
        lt
        if_false 0:94
        enter_scope 3
        line_num 6
        scope_make_ref a,1:78,3
        scope_get_var a,3
        neg
        label 1:78
   78:  insert3
        put_ref_value
        drop
        leave_scope 3

;;     }

        line_num 7
        label 0:94
   94:  leave_scope 2

;;     return a

        line_num 8
        scope_get_var a,1
        return

;; }

pass 2
;; function func () {

        set_loc_uninitialized 0: a

;;     let a = 1

        line_num 4
        push_i32 1
        put_loc 0: a

;;     if (a < 0) {

        line_num 5
        get_loc_check 0: a
        push_i32 0
        lt
        if_false 0:59

;;         a = -a

        line_num 6
        get_loc_check 0: a
        neg
        dup
        put_loc_check 0: a
        drop

;;     }

        line_num 7
        label 0:59

;;     return a

   59:  line_num 8
        get_loc_check 0: a
        return

;; }

./test2.js:3: function: func
  mode: strict
  locals:
    0: let a [level:1 next:-1]
  stack_size: 2
  opcodes:
;; function func () {

        set_loc_uninitialized 0: a

;;     let a = 1

        push_1 1
        put_loc0 0: a

;;     if (a < 0) {

        get_loc_check 0: a
        push_0 0
        lt
        if_false8 21

;;         a = -a

        get_loc_check 0: a
        neg
        dup
        put_loc_check 0: a
        drop

;;     }
;;     return a

   21:  get_loc_check 0: a
        return

;; }
        
pass 1
;; () => {

        enter_scope 1

;;         return a + b;

        line_num 5
        scope_get_var a,1
        scope_get_var b,1
        add
        return

;;     }
 */

/*
pass 2
;; () => {
;;         return a + b;

        line_num 5
        get_var_ref 0: a
        get_var_ref_check 1: b
        add
        return

;;     }
 */

/*
./test2.js:4: function: <null>
  closure vars:
    0: a local:arg0 var
    1: b local:loc0 let
  stack_size: 2
  opcodes:
;; () => {
;;         return a + b;

        get_var_ref0 0: a
        get_var_ref_check 1: b
        add
        return

;;     }
*/

/*
pass 1
;; function func (a) {

        enter_scope 1

;;     let b = 2;

        line_num 3
        push_i32 2
        scope_put_var_init b,1

;;     return () => {
;;         return a + b;
;;     }

        line_num 6
        fclosure 0: [bytecode <null>]
        set_name "<null>"
        return

;; }
*/

/*
pass 2
;; function func (a) {

        set_loc_uninitialized 0: b

;;     let b = 2;

        line_num 3
        push_i32 2
        put_loc 0: b

;;     return () => {
;;         return a + b;
;;     }

        line_num 6
        fclosure 0: [bytecode <null>]
        return

;; }
*/

/*
./test2.js:2: function: func
  args: a
  locals:
    0: let b [level:1 next:-1]
  stack_size: 1
  opcodes:
;; function func (a) {

        set_loc_uninitialized 0: b

;;     let b = 2;

        push_2 2
        put_loc0 0: b

;;     return () => {
;;         return a + b;
;;     }

        fclosure8 0: [bytecode <null>]
        return

;; }
*/

/*
pass 1
        line_num 0
        enter_scope 1
        line_num 9
        scope_get_var func,1
        push_i32 1
        call 1
        call 0
        scope_put_var_init sum1,1
        line_num 12
        scope_get_var Object,1
        get_field2 create
        object
        line_num 13
        push_i32 3
        define_field c
        line_num 14
        call_method 1
        scope_put_var_init obj,1
        line_num 15
        scope_get_var obj,1
        push_i32 4
        insert2
        put_field d
        put_loc 0: "<ret>"
        line_num 17
        scope_get_var obj,1
        get_field c
        scope_get_var obj,1
        get_field d
        add
        scope_put_var_init sum2,1
        get_loc 0: "<ret>"
        return
*/

/*
pass 2
        check_define_var func,64
        check_define_var sum1,128
        check_define_var obj,128
        check_define_var sum2,128
        line_num 0
        fclosure 0: [bytecode func]
        define_func func,0
        define_var sum1,130
        define_var obj,130
        define_var sum2,130
        line_num 9
        get_var func
        push_i32 1
        call 1
        call 0
        put_var_init sum1
        line_num 12
        get_var Object
        get_field2 create
        object
        line_num 13
        push_i32 3
        define_field c
        line_num 14
        call_method 1
        put_var_init obj
        line_num 15
        get_var obj
        push_i32 4
        insert2
        put_field d
        put_loc 0: "<ret>"
        line_num 17
        get_var obj
        get_field c
        get_var obj
        get_field d
        add
        put_var_init sum2
        get_loc 0: "<ret>"
        return
*/

/*
./test2.js:1: function: <eval>
  locals:
    0: var <ret>
  stack_size: 4
  opcodes:
        check_define_var func,64
        check_define_var sum1,128
        check_define_var obj,128
        check_define_var sum2,128
        fclosure8 0: [bytecode func]
        define_func func,0
        define_var sum1,130
        define_var obj,130
        define_var sum2,130
        get_var func
        push_1 1
        call1 1
        call0 0
        put_var_init sum1
        get_var Object
        get_field2 create
        object
        push_3 3
        define_field c
        call_method 1
        put_var_init obj
        get_var obj
        push_4 4
        insert2
        put_field d
        put_loc0 0: "<ret>"
        get_var obj
        get_field c
        get_var obj
        get_field d
        add
        put_var_init sum2
        get_loc0 0: "<ret>"
        return
 */